package com.beauty.dressing.module.market.holder;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.beauty.dressing.R;
import com.beauty.dressing.common.base.BaseRecyclerViewHolder;
import com.beauty.dressing.common.bean.BaseBean;
import com.beauty.dressing.common.view.NoScrollGridView;
import com.facebook.drawee.view.SimpleDraweeView;
import com.framework.common.base.IBaseAdapter;
import com.xiaolanba.commonlib.fresco.FrescoUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * @author xutingz
 * @E-mail xutz@xianlanba.com
 * @date 2018/05/03
 */

public class GoodsRecommdHolder extends BaseRecyclerViewHolder<BaseBean> {
    private NoScrollGridView mGridView;
    private List<BaseBean> gridList = new ArrayList<>();
    public GoodsRecommdHolder(Context context, LayoutInflater inflater, ViewGroup viewGroup) {
        super(R.layout.course_guide_item, context, inflater, viewGroup);
        for (int i=0;i<4;i++){
            gridList.add(new BaseBean());
        }
    }

    @Override
    public void findView() {
        mGridView = itemView.findViewById(R.id.gridview);
    }

    @Override
    public void bindData(BaseBean bean, int position) {
        GuideListAdapter adapter = new GuideListAdapter(mContext);
        adapter.setList(gridList);
        mGridView.setAdapter(adapter);
    }


    @Override
    public void onItemClick(BaseBean bean, int position) {

    }

    private class GuideListAdapter extends IBaseAdapter<BaseBean>{

        public GuideListAdapter(Context context) {
            super(context);
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            convertView = mInflater.inflate(R.layout.goods_recommd_grid_item,null);
            SimpleDraweeView simpleDraweeView = convertView.findViewById(R.id.header_img);
            FrescoUtil.loadImage(simpleDraweeView,"https://tvax1.sinaimg.cn/crop.9.0.493.493.180/005Md5lgly8fgzsynsl39j30e80dp74x.jpg");
            return convertView;
        }
    }
}
